//
//  Model_Base.m
//  Qianbao
//
//  Created by zhangtie on 13-4-3.
//  Copyright (c) 2013年 qianwang365. All rights reserved.
//

#import "QBDataSourceItem.h"

@implementation DataItem

@synthesize data_type = _data_type, item_data = _item_data;

- (void)dealloc
{
    SIMPLE_SAFERELEASE(_item_data);
    [super dealloc];
}

- (id)init
{
    self = [super init];
    if(self)
    {
        _data_type = DATA_TYPE_VALUE;
    }
    return self;
}

+ (id)dataItemWithData:(id)data
{
    DataItem *item = [[DataItem alloc]initWithData:data];
    return [item autorelease];
}

- (id)initWithData:(id)data
{
    self = [super init];
    if(self)
    {
        if([data isKindOfClass:[NSDictionary class]])
        {
            _data_type = DATA_TYPE_DICTIONARY;
        }
        else
        {
            _data_type = DATA_TYPE_VALUE;
        }
        self.item_data = data;
    }
    return self;
}
@end
